home *** CD-ROM | disk | FTP | other *** search
- function callDescriptions()
- {
- var _loc1_ = "L" + level;
- var _loc2_ = "Par Score: " + parTimes[level - 1];
- parR.text = _loc2_;
- proR.text = "Pro Score: " + proScores[level - 1];
- descriptR.text = _loc1_;
- if(Number(totUp + totDown + totLeft + totRight) > parTimes[level - 1])
- {
- usedR = "Total Used: <font color=\'#990000\'>" + Number(totUp + totDown + totLeft + totRight) + "</font>";
- }
- else
- {
- usedR = "Total Used: <font color=\'#FFFFFF\'>" + Number(totUp + totDown + totLeft + totRight) + "</font>";
- }
- }
- function resetCompulses()
- {
- totLeft = totRight = totUp = totDown = 0;
- holder.removeMovieClip();
- createEmptyMovieClip("holder",k++);
- compulses.splice(0,compulses.length);
- }
- function triggerInstantReplay()
- {
- levelComplete.removeMovieClip();
- levelMenu.removeMovieClip();
- mainMode = "instantReplay";
- globalPause = false;
- cStatus = true;
- resetMap();
- playCounter = 0;
- playMode = "paused";
- shel = attachMovie("playControls","playControls",k++);
- }
- function backToMenu()
- {
- killSwitch();
- gotoAndStop("menu");
- }
- function replayLevel()
- {
- globalPause = false;
- cStatus = false;
- resetButton._visible = true;
- levelComplete.removeMovieClip();
- levelMenu.removeMovieClip();
- resetMap();
- mainMode = "normal";
- ball.gotoAndStop(1);
- goButton._visible = true;
- stopButton._visible = false;
- resetRecordMemory();
- }
- function killSwitch()
- {
- for(var _loc2_ in _root)
- {
- if(typeof _root[_loc2_] == "movieclip")
- {
- _root[_loc2_].removeMovieClip();
- }
- }
- }
- function closePlayControls()
- {
- globalPause = true;
- cStatus = false;
- triggerLevelMenu();
- resetMap();
- mainMode = "normal";
- playControls.removeMovieClip();
- }
- function nextLevel()
- {
- level++;
- levelDisp = "L" + level;
- resetButton._visible = true;
- clearBitmap();
- resetCompulses();
- callDescriptions();
- levelComplete.removeMovieClip();
- levelMenu.removeMovieClip();
- levels.nextFrame();
- globalPause = false;
- cStatus = false;
- stopButton._visible = false;
- goButton._visible = true;
- ball.gotoAndStop(1);
- mainMode = "normal";
- resetMap();
- resetRecordMemory();
- }
- function playPoints()
- {
- if(playMode == "normalPlay")
- {
- playCounter++;
- }
- if(playMode == "normalRewind")
- {
- playCounter--;
- }
- if(playMode == "fastPlay")
- {
- playCounter += 4;
- }
- if(playMode == "fastRewind")
- {
- playCounter -= 4;
- }
- if(playMode == "slowPlay")
- {
- playCounter += 0.5;
- }
- if(playMode == "slowRewind")
- {
- playCounter -= 0.5;
- }
- ball._x = recordX[playCounter];
- ball._y = recordY[playCounter];
- if(playCounter > recordX.length)
- {
- if(playLoop)
- {
- playCounter = 0;
- }
- else
- {
- playCounter = recordX.length;
- }
- }
- if(playCounter < 0)
- {
- playCounter = 0;
- }
- }
- function bitmapLine(startx, starty, endx, endy)
- {
- myX = Array();
- myY = Array();
- x3 = (endx - startx) / 100;
- y3 = (endy - starty) / 100;
- a = 1;
- while(a < 101)
- {
- startx += x3;
- starty += y3;
- myX.push(startx);
- myY.push(starty);
- a++;
- }
- a = 1;
- while(a < 101)
- {
- bmp1.setPixel32(myX[a - 1],myY[a - 1],872415231);
- a++;
- }
- }
- function clearBitmap()
- {
- bmp1.fillRect(new flash.geom.Rectangle(0,0,550,550),0);
- olderX = ball._x;
- olderY = ball._y;
- }
- function drawPath()
- {
- if(!hitBomb)
- {
- bitmapLine(ball._x,ball._y,olderX,olderY);
- olderX = ball._x;
- olderY = ball._y;
- }
- }
- function goalDetection()
- {
- if(ball.hitTest(levels.goal.hitA))
- {
- globalPause = true;
- shel = attachMovie("levelComplete","levelComplete",k++);
- shel._x = levels.goal._x;
- shel._y = levels.goal._y;
- tempNumber = Number(totUp + totDown + totLeft + totRight);
- if(myTimes[level - 1] == 0)
- {
- myTimes[level - 1] = tempNumber;
- }
- else if(myTimes[level - 1] > tempNumber)
- {
- myTimes[level - 1] = tempNumber;
- }
- saveGame();
- }
- }
- function triggerLevelMenu()
- {
- shel = attachMovie("levelMenu","levelMenu",k++);
- shel._x = 93;
- shel._y = 230;
- shel.levelMenuDisp.text = "Level " + level + " Completed!";
- }
- function resetMap()
- {
- ball._x = levels.startPoint._x;
- ball._y = levels.startPoint._y;
- xVel = 0;
- yVel = 0;
- totRings = ringsOnLevels[level - 1];
- i = 1;
- while(i <= totRings)
- {
- levels.goal["ring" + i]._visible = false;
- levels["rSwitch" + i]._visible = true;
- i++;
- }
- i = totRings + 1;
- while(i <= 4)
- {
- levels.goal["ring" + i]._visible = true;
- levels["rSwitch" + i]._visible = false;
- i++;
- }
- i = 1;
- while(i <= 4)
- {
- levels["rSwitch" + i].gotoAndStop(1);
- i++;
- }
- if(totRings != 0)
- {
- levels.goal.gotoAndStop(2);
- }
- ringsCollected = 0;
- }
- function ringsHad()
- {
- i = 1;
- while(i <= 4)
- {
- if(ball.hitTest(levels["rSwitch" + i]))
- {
- if(levels["rSwitch" + i]._visible && levels["rSwitch" + i]._currentframe == 1)
- {
- ringsCollected++;
- levels.goal["ring" + i]._visible = true;
- levels["rSwitch" + i].gotoAndStop(2);
- shel = attachMovie("liner","liner" + k,k++);
- shel._x = 0;
- shel._y = 0;
- switch(i)
- {
- case 1:
- hexy = 13209;
- break;
- case 2:
- hexy = 16711680;
- break;
- case 3:
- hexy = 13408512;
- break;
- case 4:
- hexy = 9657208;
- }
- shel.flip.lineStyle(10,hexy,50);
- shel.flip.moveTo(levels["rSwitch" + i]._x,levels["rSwitch" + i]._y);
- shel.flip.lineTo(levels._x + levels.goal._x,levels._y + levels.goal._y);
- shel.flip.lineStyle(2,hexy,100);
- shel.flip.moveTo(levels["rSwitch" + i]._x,levels["rSwitch" + i]._y);
- shel.flip.lineTo(levels._x + levels.goal._x,levels._y + levels.goal._y);
- }
- }
- i++;
- }
- if(ringsCollected == totRings)
- {
- levels.goal.gotoAndStop(1);
- }
- }
- function resetRecordMemory()
- {
- recordX.splice(0,recordX.length);
- recordY.splice(0,recordY.length);
- }
- function record()
- {
- recordX.push(ball._x);
- recordY.push(ball._y);
- }
- function ballColors()
- {
- ball.gotoAndStop(2);
- }
- function depths()
- {
- drawArea.swapDepths(k++);
- ball.swapDepths(k++);
- }
- function compulseReactions()
- {
- i = 0;
- while(i < compulses.length)
- {
- tile = holder[compulses[i]];
- if(tile.hitA.hitTest(ball))
- {
- switch(tile.type)
- {
- case "left":
- xVel -= boostSpeed;
- break;
- case "right":
- xVel += boostSpeed;
- break;
- case "up":
- yVel -= boostSpeed;
- break;
- case "down":
- yVel += boostSpeed;
- }
- }
- i++;
- }
- }
- function boundaries()
- {
- if(ball._y + radius > 460)
- {
- yVel = - Math.abs(yVel);
- ball._y = 460 - radius;
- yDamper();
- }
- if(ball._y - radius < 10)
- {
- yVel = Math.abs(yVel);
- ball._y = 10 + radius;
- yDamper();
- }
- if(ball._x + radius > 540)
- {
- xVel = - Math.abs(xVel);
- ball._x = 540 - radius;
- xDamper();
- }
- if(ball._x - radius < 10)
- {
- xVel = Math.abs(xVel);
- ball._x = 10 + radius;
- xDamper();
- }
- }
- function ballVelocity()
- {
- yVel += gravity;
- ball._x += xVel;
- ball._y += yVel;
- }
- function xDamper()
- {
- xVel *= 0.9;
- if(Math.abs(xVel) > 2)
- {
- rav.start(0,1);
- }
- }
- function yDamper()
- {
- yVel *= 0.9;
- if(Math.abs(yVel) > 2)
- {
- rav.start(0,1);
- }
- }
- function triggerStoppage()
- {
- cStatus = false;
- ball._visible = true;
- ball.gotoAndStop(1);
- resetMap();
- resetRecordMemory();
- goButton._visible = true;
- stopButton._visible = false;
- resetButton._visible = true;
- }
- stop();
- var ringSpeed = 3;
- var cStatus = false;
- var gravity = 0.3;
- var gDirection = "down";
- var xVel = 0;
- var yVel = 0;
- var boostSpeed = 1;
- var radius = ball._width / 2;
- var totUp = 0;
- var totDown = 0;
- var totLeft = 0;
- var totRight = 0;
- var globalPause = false;
- var level = levChoice;
- var levelDisp = "L" + level;
- levels.gotoAndStop(level);
- callDescriptions();
- var recordX = new Array();
- var recordY = new Array();
- var playCounter = 0;
- var playLoop = false;
- var playMode = "paused";
- var mainMode = "normal";
- onEnterFrame = function()
- {
- callDescriptions();
- if(!globalPause)
- {
- if(cStatus)
- {
- if(mainMode == "normal")
- {
- mainRings();
- ballColors();
- compulseReactions();
- boundaries();
- ballVelocity();
- record();
- depths();
- goalDetection();
- ringsHad();
- drawPath();
- }
- else if(mainMode == "instantReplay")
- {
- playPoints();
- }
- }
- }
- };
- var bmp1 = new flash.display.BitmapData(550,550,true,0);
- drawArea.attachBitmap(bmp1,k++);
- var olderX = 0;
- var olderY = 0;
- var hitBomb = false;
- var totRings = 0;
- var ringsCollected = 0;
- resetMap();
- var compulses = new Array();
- var rav = new Sound(this);
- rav.attachSound("wood3");
- var k = 0;
- var foundLove = false;
- var dropOne = true;
- _root.createEmptyMovieClip("holder",k++);
- onMouseDown = function()
- {
- if(!cStatus && !globalPause)
- {
- dropOne = true;
- i = 0;
- while(i < compulses.length)
- {
- if(holder[compulses[i]].hitA.hitTest(_xmouse,_ymouse))
- {
- dropOne = false;
- }
- i++;
- }
- foundLove = false;
- if(leftTileButton.hitA.hitTest(_xmouse,_ymouse))
- {
- shel = holder.attachMovie("leftTile","l" + k,k++);
- shel.type = "left";
- foundLove = true;
- totLeft++;
- }
- else if(upTileButton.hitA.hitTest(_xmouse,_ymouse))
- {
- shel = holder.attachMovie("upTile","l" + k,k++);
- shel.type = "up";
- foundLove = true;
- totUp++;
- }
- else if(rightTileButton.hitA.hitTest(_xmouse,_ymouse))
- {
- shel = holder.attachMovie("rightTile","l" + k,k++);
- shel.type = "right";
- foundLove = true;
- totRight++;
- }
- else if(downTileButton.hitA.hitTest(_xmouse,_ymouse))
- {
- shel = holder.attachMovie("downTile","l" + k,k++);
- shel.type = "down";
- foundLove = true;
- totDown++;
- }
- else
- {
- i = 0;
- while(i < compulses.length)
- {
- if(holder[compulses[i]].hitTest(_xmouse,_ymouse))
- {
- holder[compulses[i]].startDrag();
- }
- i++;
- }
- }
- if(foundLove)
- {
- shel._x = _xmouse;
- shel._y = _ymouse;
- shel.startDrag(true);
- compulses.push("l" + k);
- }
- }
- trace(compulses);
- };
- onMouseUp = function()
- {
- i = 0;
- while(i < compulses.length)
- {
- holder[compulses[i]].stopDrag();
- if(holder[compulses[i]]._y > 460)
- {
- switch(holder[compulses[i]].type)
- {
- case "left":
- totLeft--;
- break;
- case "right":
- totRight--;
- break;
- case "up":
- totUp--;
- break;
- case "down":
- totDown--;
- }
- holder[compulses[i]].removeMovieClip();
- compulses.splice(i,1);
- }
- i++;
- }
- };
- goButton._visible = true;
- stopButton._visible = false;
- goButton.onRelease = function()
- {
- hitBomb = false;
- if(!globalPause && mainMode == "normal")
- {
- drawArea.clear();
- drawArea.moveTo(ball._x,ball._y);
- clearBitmap();
- cStatus = true;
- stopButton._visible = true;
- goButton._visible = false;
- resetButton._visible = false;
- }
- };
- stopButton.onRelease = function()
- {
- if(!globalPause && mainMode == "normal")
- {
- triggerStoppage();
- }
- };
- resetButton.onRelease = function()
- {
- if(!globalPause && mainMode == "normal")
- {
- drawArea.clear();
- clearBitmap();
- resetCompulses();
- }
- };
-